//
//  UIViewController+YYNavigationView.m
//  xxxx
//
//  Created by yangyang on 2016/11/13.
//  Copyright © 2016年 机智的静默( https://github.com/jizhidejingmo ). All rights reserved.
//

#import "UIViewController+YYNavigationView.h"
#import <objc/runtime.h>

static const void *kNavigationController = @"YYNavigationController";
static const void *kNavigationBar = @"YYNavigationBar";
static const void *kNavigationItem = @"YYNavigationItem";

@implementation UIViewController (YYNavigationView)

#pragma mark - Setter

- (void)setYy_navigationController:(YYNavigationController *)yy_navigationController {
    objc_setAssociatedObject(self, kNavigationController, yy_navigationController, OBJC_ASSOCIATION_ASSIGN);
}

- (void)setYy_navigationBar:(YYNavigationBar *)yy_navigationBar {
    objc_setAssociatedObject(self, kNavigationBar, yy_navigationBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (void)setYy_navigationItem:(YYNavigationItem *)yy_navigationItem {
    objc_setAssociatedObject(self, kNavigationItem, yy_navigationItem, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

#pragma mark - Getter

- (YYNavigationController *)yy_navigationController {
    return objc_getAssociatedObject(self, kNavigationController);
}

- (YYNavigationBar *)yy_navigationBar {
    return objc_getAssociatedObject(self, kNavigationBar);
}

- (YYNavigationItem *)yy_navigationItem {
    return objc_getAssociatedObject(self, kNavigationItem);
}

@end
